import { Application } from 'egg';

export default (app: Application) => {
  const subRouter = app.router.namespace('/api');
  subRouter.get('index', '/index', app.controller.businessCate.index);
  subRouter.post('createBusinessCate', '/createBusinessCate', app.controller.businessCate.create);
  subRouter.post('updateBusinessCate', '/createBusinessCate/:id', app.controller.businessCate.update);
  subRouter.post('deleteBusinessCate', '/deleteBusinessCate/:id', app.controller.businessCate.delete);
  subRouter.post('deleteBusinessInfo', '/deleteBusinessInfo/:id', app.controller.businessInfo.delete);
  subRouter.post('createBusinessInfo', '/createBusinessInfo', app.controller.businessInfo.create);
  subRouter.post('updateBusinessInfo', '/createBusinessInfo/:id', app.controller.businessInfo.update);
  subRouter.get('listBusinessCate', '/listBusinessCate', app.controller.businessCate.getList);
  subRouter.get('lustBusinessInfo', '/listBusinessInfo', app.controller.businessInfo.getList);
  subRouter.post('login', '/login', app.controller.user.login);
  subRouter.post('upload', '/upload', app.controller.common.upload);
  subRouter.post('uploadMP4', '/uploadMP4', app.controller.common.uploadMP4);
  subRouter.get('getAvatar', '/getAvatar', app.controller.avatar.find);
  subRouter.post('createAvatar', '/createAvatar', app.controller.avatar.create);
  subRouter.get('getYoungCardByStatus', '/getYoungCardByStatus', app.controller.youngCard.getYoungCardByStatus);
  subRouter.post('updateYoungCard', '/updateYoungCard/:id', app.controller.youngCard.updateYoungCard);
  subRouter.post('updateYoungCard2', '/updateYoungCard2/:id', app.controller.youngCard.update);
  subRouter.post('deleteYoungCard', '/deleteYoungCard/:id', app.controller.youngCard.deleteYoungCard);

  subRouter.get('users', '/users', app.controller.user.list);
  subRouter.post('createuser', '/users', app.controller.user.create);
  subRouter.post('deleteuser', '/users/:id', app.controller.user.delete);


  subRouter.get('courses', '/courses', app.controller.courses.list);
  subRouter.post('createcourses', '/courses', app.controller.courses.create);
  subRouter.post('deletecourses', '/courses/:id', app.controller.courses.delete);

  subRouter.get('videos', '/videos', app.controller.videos.list);
  subRouter.post('createvideos', '/videos', app.controller.videos.create);
  subRouter.post('delvideos', '/videos/:id', app.controller.videos.delete);


};
